function t_appendGoogleMap(recid,key){if("object"==typeof google&&"object"==typeof google.maps)t_handleGoogleApiReady(recid);else if(window.googleapiiscalled)setTimeout((function(){t_appendGoogleMap(recid,key)}),1e3);else{var runfunc="window.t_handleGoogleApiReady_"+recid+' = function () { t_handleGoogleApiReady("'+recid+'") }';eval(runfunc);var langPreferences="",mapLang="",tildaMapElement=document.querySelector("#rec"+recid+" .t-map"),tildaMapElLang=tildaMapElement.getAttribute("data-map-language");tildaMapElement&&(mapLang=tildaMapElLang||""),mapLang&&2===mapLang.length&&(langPreferences="&language="+mapLang);var script=document.createElement("script");script.type="text/javascript";var mapKey=key?key.trim():"";script.src="https://maps.google.com/maps/api/js?key="+mapKey+"&callback=t_handleGoogleApiReady_"+recid+langPreferences,document.body.appendChild(script),window.googleapiiscalled=!0}}function t_handleGoogleApiReady(recid){var gmaps=document.querySelectorAll("#rec"+recid+" .t-map");if(!gmaps.length)return!1;Array.prototype.forEach.call(gmaps,(function(gmap){var arMarkers=window["arMapMarkers"+recid];window.isDragMap=!window.isMobile;var mapStyleAttr=gmap.getAttribute("data-map-style"),mapColorAttr=gmap.getAttribute("data-map-color"),mapModeAttr=gmap.getAttribute("data-map-mode"),mapZoomAttr=gmap.getAttribute("data-map-zoom"),myLatLng=arMarkers.length>0&&new google.maps.LatLng(parseFloat(arMarkers[0].lat),parseFloat(arMarkers[0].lng)),myOptions={zoom:parseInt(mapZoomAttr,10),center:myLatLng,scrollwheel:!1,gestureHandling:"cooperative",zoomControl:!0,styles:getMapStyle(mapModeAttr,mapStyleAttr,mapColorAttr)};function getMapStyle(mode,style,color){if(mode&&!color)return style?JSON.parse(style):[];if(mode&&color){var hsl=t_map_hexToHsl(color),saturation=2*hsl[1]-100,lightness=2*hsl[2]-100,invert="bw_dark"===mode;return[{featureType:"all",elementType:"all",stylers:[{visibility:"simplified"},{hue:color},{saturation:saturation},{lightness:invert?-lightness:lightness},{invert_lightness:invert}]}]}}var map=new google.maps.Map(gmap,myOptions),bounds=new google.maps.LatLngBounds;function getSvgMarker(color){return{path:"M182.9,551.7c0,0.1,0.2,0.3,0.2,0.3S358.3,283,358.3,194.6c0-130.1-88.8-186.7-175.4-186.9 C96.3,7.9,7.5,64.5,7.5,194.6c0,88.4,175.3,357.4,175.3,357.4S182.9,551.7,182.9,551.7z M122.2,187.2c0-33.6,27.2-60.8,60.8-60.8 c33.6,0,60.8,27.2,60.8,60.8S216.5,248,182.9,248C149.4,248,122.2,220.8,122.2,187.2z",fillColor:color||"#ea4335",fillOpacity:1,strokeColor:"#5e5e5e",strokeOpacity:.5,strokeWeight:1,rotation:0,scale:.075,anchor:new google.maps.Point(180,555)}}function getAnchor(marker){if(marker.offset){var arr=marker.offset.replace(/\s/g,"").split(","),x=-1*+arr[0],y=-1*+arr[1];return new google.maps.Point(x,y)}return new google.maps.Point(0,48)}Array.prototype.forEach.call(arMarkers,(function(el){var myLatLng=new google.maps.LatLng(parseFloat(el.lat),parseFloat(el.lng)),icon={url:el.url,size:new google.maps.Size(48,48),anchor:getAnchor(el)},marker=new google.maps.Marker({position:myLatLng,visible:!el.isHidden,map:map,title:el.title,icon:el.url?icon:getSvgMarker(el.color)});bounds.extend(myLatLng),(el.descr||el.title)&&t_map__attachInfoMessage(marker,el.descr,el.title,el.isOpen)}));var mapPathAttr=gmap.getAttribute("data-map-path"),mapPathColorAttr=gmap.getAttribute("data-map-path-color"),mapPathWeightAttr=gmap.getAttribute("data-map-path-weight"),path;null!==mapPathAttr&&arMarkers.length>1&&new google.maps.Polyline({path:arMarkers.map((function(item){return new google.maps.LatLng(parseFloat(item.lat),parseFloat(item.lng))})),geodesic:!0,strokeColor:mapPathColorAttr||"#ff6d61",strokeWeight:parseInt(mapPathWeightAttr)||2}).setMap(map);function t_map__attachInfoMessage(marker,descr,title,isOpen){var textarea=document.createElement("textarea");textarea.innerHTML=descr;var baloonTitle,baloonDescr,baloonContent=[title?""+title+"":"",textarea.textContent].filter(Boolean).join("
"),infowindow=new google.maps.InfoWindow({content:baloonContent});isOpen&&infowindow.open(marker.get("map"),marker),marker.addListener("click",(function(){infowindow.open(marker.get("map"),marker)}))}if(arMarkers.length>1){map.fitBounds(bounds);var listener=google.maps.event.addListener(map,"idle",(function(){(map.getZoom()>parseInt(mapZoomAttr,10)||0===map.getZoom())&&map.setZoom(parseInt(mapZoomAttr,10)),map.getZoom()>16&&map.setZoom(16),google.maps.event.removeListener(listener)}))}google.maps.event.addDomListener(window,"resize",(function(){var center=map.getCenter(),zoom=parseInt(mapZoomAttr,10);google.maps.event.trigger(map,"resize"),map.setCenter(center),arMarkers.length>0&&(map.fitBounds(bounds),zoom>0&&(map.getZoom()>zoom||0==map.getZoom())&&map.setZoom(zoom))})),gmap.addEventListener("displayChanged",(function(){google.maps.event.trigger(map,"resize")})),gmap.addEventListener("sizechange",(function(){google.maps.event.trigger(map,"resize")}))}))}function t_appendYandexMap(recid,key){if("object"==typeof ymaps&&"function"==typeof ymaps.Map)t_handleYandexApiReady(recid);else if(window.yandexmapsapiiscalled)setTimeout((function(){t_appendYandexMap(recid,key)}),1e3);else{var runfunc="window.t_handleYandexApiReady_"+recid+' = function () { return t_handleYandexApiReady("'+recid+'") }';eval(runfunc);var mapLang="",tildaMapElement=document.querySelector("#rec"+recid+" .t-map"),tildaMapElAttr=tildaMapElement.getAttribute("data-map-language");if(tildaMapElement)switch(tildaMapElAttr){case"EN":mapLang="en_US";break;default:mapLang="ru_RU"}var script=document.createElement("script");script.type="text/javascript",script.src="https://api-maps.yandex.ru/2.1/?lang="+mapLang+"&coordorder=latlong&onload=t_handleYandexApiReady_"+recid,key&&(script.src+="&apikey="+key),document.body.appendChild(script),window.yandexmapsapiiscalled=!0}}function t_handleYandexApiReady(recid){var ymapsArr=document.querySelectorAll("#rec"+recid+" .t-map");if(!ymapsArr.length)return!1;Array.prototype.forEach.call(ymapsArr,(function(ymap){var arMarkers=window["arMapMarkers"+recid],mapZoomAttr=ymap.getAttribute("data-map-zoom");window.isDragMap=!window.isMobile;var myLatLng=arMarkers.length>0&&[parseFloat(arMarkers[0].lat),parseFloat(arMarkers[0].lng)],myOptions={zoom:parseInt(mapZoomAttr,10),center:myLatLng,scrollZoom:!1,controls:["typeSelector","zoomControl"],drag:window.isDragMap},map=new ymaps.Map(ymap,myOptions),eventsPane,eventsPaneEl=map.panes.get("events").getElement(),mobilePanelText={EN:"Use two fingers to move the map",RU:"Чтобы переместить карту проведите по ней двумя пальцами",FR:"Utilisez deux doigts pour déplacer la carte",DE:"Verschieben der Karte mit zwei Fingern",ES:"Para mover el mapa, utiliza dos dedos",PT:"Use dois dedos para mover o mapa",UK:"Переміщуйте карту двома пальцями",JA:"地図を移動させるには指 2 本で操作します",ZH:"使用双指移动地图",PL:"Przesuń mapę dwoma palcami",KK:"Картаны екі саусақпен жылжытыңыз",IT:"Utilizza due dita per spostare la mappa",LV:"Lai pārvietotu karti, bīdiet to ar diviem pirkstiem"},mobilePanelStyles={alignItems:"center",boxSizing:"border-box",color:"white",display:"flex",justifyContent:"center",fontSize:"22px",fontFamily:"Arial,sans-serif",opacity:"0.0",padding:"25px",textAlign:"center",transition:"opacity .3s",touchAction:"auto"};function getIconImageOffset(marker){return marker.url&&marker.offset?marker.offset.replace(/\s/g,"").split(",").map(Number):marker.url?[0,-48]:void 0}Array.prototype.forEach.call(Object.keys(mobilePanelStyles),(function(name){eventsPaneEl.style[name]=mobilePanelStyles[name]})),map.behaviors.disable("scrollZoom"),window.isMobile&&(map.behaviors.disable("drag"),ymaps.domEvent.manager.add(eventsPaneEl,"touchmove",(function(event){1===event.get("touches").length&&(eventsPaneEl.style.transition="opacity .3s",eventsPaneEl.style.background="rgba(0, 0, 0, .45)",eventsPaneEl.textContent=mobilePanelText[window.browserLang]||mobilePanelText.EN,eventsPaneEl.style.opacity="1")})),ymaps.domEvent.manager.add(eventsPaneEl,"touchend",(function(){eventsPaneEl.style.transition="opacity .8s",eventsPaneEl.style.opacity="0"})));var placemarks=arMarkers.map((function(marker){var myLatlng=[parseFloat(marker.lat),parseFloat(marker.lng)],textarea=document.createElement("textarea");textarea.innerHTML=marker.descr;var baloonTitle,baloonDescr,baloonContent=[marker.title?""+marker.title+"":"",textarea.textContent].filter(Boolean).join("
"),placemark;return new ymaps.Placemark(myLatlng,{hintContent:marker.title,balloonContent:baloonContent},{iconColor:marker.color||void 0,iconLayout:marker.url?"default#imageWithContent":void 0,iconImageHref:marker.url||void 0,iconImageSize:marker.url?[48,48]:void 0,iconImageOffset:getIconImageOffset(marker),visible:!marker.isHidden})})),collection=new ymaps.GeoObjectCollection({});placemarks.forEach((function(placemark){collection.add(placemark)})),map.geoObjects.add(collection),placemarks.forEach((function(placemark,index){arMarkers[index].isOpen&&placemark.balloon.open()}));var mapPathAttr=ymap.getAttribute("data-map-path"),mapPathColorAttr=ymap.getAttribute("data-map-path-color"),mapPathWeightAttr=ymap.getAttribute("data-map-path-weight");if(arMarkers.length>1&&null!==mapPathAttr){var myPolyline=new ymaps.Polyline(arMarkers.map((function(marker){return[parseFloat(marker.lat),parseFloat(marker.lng)]})),{},{strokeColor:mapPathColorAttr||"#06f",strokeWidth:parseInt(mapPathWeightAttr,10)||1,strokeOpacity:.85});map.geoObjects.add(myPolyline)}var mapColorAttr=ymap.getAttribute("data-map-color"),mapModeAttr=ymap.getAttribute("data-map-mode");if(mapModeAttr){var groundPaneElementChild=ymap.querySelector('ymaps[class$="ground-pane" i] > ymaps');if(groundPaneElementChild&&(groundPaneElementChild.style.filter="bw_light"===mapModeAttr?"grayscale(1)":"grayscale(1) invert(1)"),mapColorAttr){var groundPaneElement=ymap.querySelector('ymaps[class$="ground-pane" i]'),coloredDiv=document.createElement("div");if(coloredDiv.style.opacity=".15",coloredDiv.style.backgroundColor=mapColorAttr,coloredDiv.style.position="absolute",coloredDiv.style.top="-2500px",coloredDiv.style.left="-2500px",coloredDiv.style.width="5000px",coloredDiv.style.height="5000px",coloredDiv.style.zIndex="9999","bw_light"===mapModeAttr){var cloneLight=coloredDiv.cloneNode();cloneLight.style.mixBlendMode="color",cloneLight.style.zIndex="9998",cloneLight.style.opacity=".5",groundPaneElement&&groundPaneElement.appendChild(cloneLight)}if("bw_dark"===mapModeAttr){var cloneDark=coloredDiv.cloneNode();cloneDark.style.mixBlendMode="soft-light",cloneDark.style.zIndex="9998",cloneDark.style.opacity=".85",groundPaneElement&&groundPaneElement.appendChild(cloneDark)}groundPaneElement&&groundPaneElement.appendChild(coloredDiv)}}var zoom=parseInt(mapZoomAttr,10);arMarkers.length>1?(map.setBounds(collection.getBounds(),{checkZoomRange:!0}).then((function(){zoom>0&&(0==map.getZoom()||map.getZoom()>zoom)&&map.setZoom(zoom)})),zoom>0&&(0==map.getZoom()||map.getZoom()>zoom)&&map.setZoom(zoom)):zoom>0&&(0==map.getZoom()||map.getZoom()>zoom)&&map.setZoom(zoom),map.events.add("sizechange",(function(){map.container.fitToViewport(),arMarkers.length>1?map.setBounds(collection.getBounds(),{checkZoomRange:!0}).then((function(){zoom>0&&(0==map.getZoom()||map.getZoom()>zoom)&&map.setZoom(zoom)})):zoom>0&&(0==map.getZoom()||map.getZoom()>zoom)&&map.setZoom(zoom)}))}))}function t_map_hexToHsl(H){var r=0,g=0,b=0;4===H.length?(r="0x"+H[1]+H[1],g="0x"+H[2]+H[2],b="0x"+H[3]+H[3]):7===H.length&&(r="0x"+H[1]+H[2],g="0x"+H[3]+H[4],b="0x"+H[5]+H[6]),r/=255,g/=255,b/=255;var cmin=Math.min(r,g,b),cmax=Math.max(r,g,b),delta=cmax-cmin,h=0,s=0,l=0;return h=0===delta?0:cmax===r?(g-b)/delta%6:cmax===g?(b-r)/delta+2:(r-g)/delta+4,(h=Math.round(60*h))<0&&(h+=360),l=(cmax+cmin)/2,[h,s=+(100*(s=0===delta?0:delta/(1-Math.abs(2*l-1)))).toFixed(1),l=+(100*l).toFixed(1)]}